package com.alks.function.controller.produce;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.entity.PcProcessChgHead;
import com.alks.entity.data.entity.PcProcessChgPart;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.chengKong.LotNoRequest;
import com.alks.function.data.request.chengKong.LotNoToStyleRequest;
import com.alks.function.service.produce.CutProcessChangeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@ApiRestController("/cut/process/change")
@Api(tags ={ "生产部-生产作业-生产派工-指令工序变更"})
@Slf4j
public class CutProcessChangeController {

    @Autowired
    private CutProcessChangeService cutProcessChangeService;

    @WebLogger
    @PostMapping("/list")
    @ApiOperation(value = "指令变更查询",tags = "生产部-生产作业-生产派工-指令工序变更")
    public ResponseInfo list(@RequestBody LotNoToStyleRequest request){
        return cutProcessChangeService.searchList(request);
    }

    @WebLogger
    @PostMapping("/part/list")
    @ApiOperation(value = "工艺变更资料查询",tags = "生产部-生产作业-生产派工-指令工序变更")
    public ResponseInfo partList(@RequestBody PcProcessChgHead pcProcessChgHead){
        return cutProcessChangeService.partList(pcProcessChgHead);
    }

    @WebLogger
    @PostMapping("/qty/list")
    @ApiOperation(value = "订单变更资料查询",tags = "生产部-生产作业-生产派工-指令工序变更")
    public ResponseInfo qtyList(@RequestBody PcProcessChgHead pcProcessChgHead){
        return cutProcessChangeService.qtyList(pcProcessChgHead);
    }

    @WebLogger
    @PostMapping("/analysis")
    @ApiOperation(value = "指令变更资料分析",tags = "生产部-生产作业-生产派工-指令工序变更")
    public ResponseInfo analysis(@RequestBody LotNoRequest request){
        return cutProcessChangeService.analysis(request);
    }

    @WebLogger
    @PostMapping("/part/update")
    @ApiOperation(value = "修改数量",tags = "生产部-生产作业-生产派工-指令工序变更")
    public ResponseInfo updatePart(@RequestBody PcProcessChgPart pcProcessChgPart){
        return cutProcessChangeService.updatePart(pcProcessChgPart);
    }

    @WebLogger
    @PostMapping("/find")
    @ApiOperation(value = "查找同配色指令",tags = "生产部-生产作业-生产派工-指令工序变更")
    public ResponseInfo find(@RequestBody LotNoRequest request){
        return cutProcessChangeService.find(request);
    }

    @WebLogger
    @PostMapping("/deal")
    @ApiOperation(value = "变更资料处理",tags = "生产部-生产作业-生产派工-指令工序变更")
    public ResponseInfo deal(@RequestBody PcProcessChgHead request, @RequestParam boolean override){
        return cutProcessChangeService.deal(request, override);
    }

    @WebLogger
    @PostMapping("/lotNoList")
    @ApiOperation(value = "指令列表",tags = "生产部-生产作业-生产派工-指令工序变更")
    public ResponseInfo getLotNoList(@RequestBody LotNoToStyleRequest request){
        return cutProcessChangeService.getLotNoList(request);
    }
}
